<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!-- 所需的文件所需的文件	外部页面引入以免多次调用时重复
<link rel="stylesheet" type="text/css"
	href="js/webuploader-0.1.5/webuploader.css" />
<script type="text/javascript" src="js/webuploader-0.1.5/webuploader.js"></script>
<script type="text/javascript" src="js/sharefunction.js"></script> -->

<style>
	/* 控制删除按钮的样式 */
	span.uploadcancel {
		width: 20px;
	    height: 17px;
	    display: inline-block;
	    background: url(images/icons.png) no-repeat;
		background-position: -48px 0px;
		cursor:pointer;
	}
</style>
<script type="text/javascript">
	//上传成功的回调函数
	function webuploadSuccez( file,response ) {
		var acal=$("#AccessoryCaList");
 		var val=acal.val();
 		var t="{\"extendId\":\""+file.id+"\",\"accessoryCAId\":\"" + response.accessoryCAId + "\",\"articleId\":\"" + response.articleId + "\"}";
		if(val==""){
			acal.val(t);
		}else{
			acal.val(val+","+t);
		}
	}
	//上传失败的回调函数
	function webuploadErr( file,response ) {
		
	}
</script>

<!-- 用来存储物件id的隐藏域 -->
<input id="AccessoryCaList" name="AccessoryCaList" value="" hidden="hidden" >
<table>
<c:forEach items="${requestScope.DictionariesArticle}" var="item" varStatus="status" >

	<tr>
		<td class="td_c_l">${item.article }</td>
		<td style="text-align: left;">
			<!--上传附件部分-->
			<div id="uploader-demo">
			    <!--用来存放item-->
			    <div id="fileList<c:out value="${status.index}"/>" class="uploader-list"></div>
			    <div id="list<c:out value="${status.index}"/>"></div>
			    <input id="ArticleId<c:out value="${status.index}"/>" type="text" value="${item.id }" hidden="hidden" />
			    <div id="filePicker<c:out value="${status.index}"/>">选择图片</div>
			</div>
			<script type="text/javascript">
				$(function(){
					//向后台传入的参数 有需要可是用一下
					var data={ArticleId:$("#ArticleId<c:out value="${status.index}"/>").val()};
					webupload("#filePicker<c:out value="${status.index}"/>","#list<c:out value="${status.index}"/>",data,"project/accessoryCa/addAccessoryCa",webuploadSuccez,webuploadErr);
				});
			</script>
		</td>
	</tr>
</c:forEach>
</table>